Skip to main content

ConsistentHash<T>

Assembly: ServiceStack.Redis.dll
View Source
Declaration
public class ConsistentHash<T>

Methods

GetTarget(String)

View Source
Declaration
public T GetTarget(string key)
Returns

<T>

Parameters
TypeName
System.Stringkey

AddTarget(T, Int32)

Adds a node and maps points across the circle

View Source
Declaration
public void AddTarget(T node, int weight)
Parameters
TypeNameDescription
<T>nodenode to add

| | System.Int32 | weight | An arbitrary number, specifies how often it occurs relative to other targets.

|

ModifiedBinarySearch(UInt64[], UInt64)

A variation of Binary Search algorithm. Given a number, matches the next highest number from the sorted array. If a higher number does not exist, then the first number in the array is returned.

View Source
Declaration
public static ulong ModifiedBinarySearch(ulong[] sortedArray, ulong val)
Returns

System.UInt64: next highest number

Parameters
TypeNameDescription
System.UInt64[]sortedArraya sorted array to perform the search

| | System.UInt64 | val | number to find the next highest number against

|

Md5Hash(String)

Given a key, generates an unsigned 64 bit hash code using MD5

View Source
Declaration
public static ulong Md5Hash(string key)
Returns

System.UInt64

Parameters
TypeName
System.Stringkey